var gulp = require('gulp'),
    less = require('gulp-less'), //编译less
    notify = require('gulp-notify'), //编译报错信息
    plumber = require('gulp-plumber'), //编译提示
    cssmin = require('gulp-minify-css'), //压缩代码
    livereload = require('gulp-livereload'); //自动刷新

gulp.task('testless', function() {
        console.log('hello')
            // gulp.src('src/**/*.js').pipe(gulp.dest('dist'))
        gulp.src('less/*.less')
            .pipe(plumber({ errorHandler: notify.onError('发生错误！！具体信息:<%=error.message%>') }))
            .pipe(less())
            .pipe(cssmin())
            .pipe(gulp.dest('css'))
            .pipe(livereload());
    })
    //实时监控文件变化
gulp.task('lesswatch', function() {
    gulp.watch('less/*.less', ['testless'])
})